#include <stdio.h>

#include "cursor.h"

void drawline_(int x, int y, int len)
{
    MOVETO(x, y);
    int i;
    for(i = 0; i < len; i++)
        printf("=");
}

void drawline(int x, int y, int len)
{
    int i;
    for(i = 0; i < len; i++)
    {
        MOVETO(x, y + i);
        printf("||");
    }
}

void drawui(int x, int y, int sizex, int sizey)
{
    int w = 16;
    CLEAR();
    printf("\033[41m");
    drawline_(x, y, sizex + w);
    drawline(x, y + 1, sizey);
    drawline(x + sizex, y + 1, sizey);
    drawline(x + sizex + w - 2, y + 1, sizey);
    drawline_(x + sizex + 2, y + 8, w - 4);
    drawline_(x, y + sizey + 1, sizex + w);
    printf("\033[0m");

    MOVETO(x + sizex + 3, y + 10);
    printf("\33[32mSCORE:\33[0m");
    MOVETO(x + sizex + 3, y + 15);
    printf("\33[32mLEVEL:\33[0m");

    fflush(stdout);
}

int main(int argc, char *argv[])
{
    //char panel[20][20];
    drawui(5, 3, 20, 20);
    MOVETO(0, 25);
    printf("\n");

    return 0;
}
